package com.cuhk.gulimall.ware.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement
@Configuration
@MapperScan("com.cuhk.gulimall.ware.dao")
public class WareMyBatisConfig {
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 配置一些MyBatis-Plus分页插件的基本属性
        // 当请求的页数，大于当前数据所能填充的最大页数时
        // 返回首页数据
        paginationInterceptor.setOverflow(true);
        // 设置每页展示数据上限1000条
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}
